<template>
  <span class="status_name" :class="'status_' + (calcStatus || 0)">{{name}}</span>
</template>
<script>
  export default {
    props: {
      name: String,
      status: Number,
      type: String
    },
    data() {
      return {
        calcStatus: 0,
      };
    },
    created() {},
    mounted() {
      if (this.type === 'task') {
        this.changeStaus()
      } else {
        this.calcStatus = this.status
      }
    },
    methods: {
      // 状态(1=未开始；2=超时未开始；3=进行中；4=已延迟；5=已完成；6=待审核；7=已关闭)
      changeStaus() {
        switch (this.status) {
          case 1: this.calcStatus = 3; break;
          case 2: this.calcStatus = 8; break;
          case 3: this.calcStatus = 4; break;
          case 4: this.calcStatus = 5; break;
          case 5: this.calcStatus = 6; break;
          case 6: this.calcStatus = 7; break;
          case 7: this.calcStatus = 0; break;
          default: this.calcStatus = 0; break;
        }
      }
    },
    filters: {},
    components: {}
  };
</script>

<style lang="less" scope>
  @import "./index.less";
</style>